import 'package:flutter_eve_plugin/store/base_action.dart';
import 'package:flutter_eve_plugin/store/health/main.dart';
import 'package:redux/redux.dart';
import 'constant.dart';

HealthState healthReducer(HealthState state, action) {
  if (!(action is BaseAction)) {
    return state;
  }
  BaseAction baseAction = action;
  switch (baseAction.type) {
    case HEALTH_PROPERTY_HEALTH:
      return state.copyWith(propertyHealthModel: baseAction.data);
    case HEALTH_PROPERTY_BODY:
      return state.copyWith(userBodyModel: baseAction.data);
    case HEALTH_SYS_CURR_PAGE:
      return state.copyWith(sysCurrPageIndex: baseAction.data);
  }
  return state;
}

// ignore: non_constant_identifier_names
final HealthReducer = combineReducers<HealthState>([healthReducer]);
